package xyz.ljcc.ccmt.repository.admin;

import java.util.List;

import org.springframework.data.jpa.repository.Query;

import xyz.ljcc.ccmt.commons.repository.base.BaseRepository;
import xyz.ljcc.ccmt.model.base.Role;

public interface RoleRepository extends BaseRepository<Role, Integer> {

	/**
	 * 根据用户ID回去对应的权限信息
	 * @param userId
	 * @return
	 */
	@Query(" select r from Role r,UserVsRole ur "
			+ " where r.id = ur.roleId and ur.loginName = ?1 order by r.id")
	List<Role> loadByLoginName(String loginName);
	
	List<Role> getByRoleNameContaining(String roleName);

}
